package test;
class Circle { 
    double radius,area;
    Circle(){
    }
    Circle(double r) {
       radius = r;
    }
    void setRadius(double r) {
       if(r>0){
          radius=r;
       }
    } 
    double getRadius(){
       return radius;
    }
    double getArea(){
       area=3.14*radius*radius;
       return area;
    }
}

public class Example5_4 {  
   public static void main(String args[]) {
       Circle circle=new Circle();
       double w=121.709;
       circle.setRadius(w);
       System.out.println("圆的半径："+circle.getRadius());
       System.out.println("圆的面积："+circle.getArea());
       System.out.println("更改向方法参数r传递值的w的值为100");
       w=100;
       System.out.println("w="+w);
       System.out.println("圆的半径："+circle.getRadius());
    }
}
